package com.fzg.controller;


import com.fzg.common.enums.ResponseWrapper;
import com.fzg.service.ChinaProvinceCityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fzg
 * @since 2022-11-21
 */
@RestController
@RequestMapping("/china-province-city")
public class ChinaProvinceCityController {


    @Autowired
    private ChinaProvinceCityService chinaProvinceCityService;


    /**
     * 省市区数据导入到MySQL
     * @return ResponseWrapper
     */
    @GetMapping("/importProvinceCityCounty")
    public ResponseWrapper importProvinceCityCounty(){
        return chinaProvinceCityService.importProvinceCityCounty();
    }


    /**
     * 获取树状结构的省市区数据
     * @return ResponseWrapper
     */
    @GetMapping("/getTreeProvinceCityCountyData")
    public ResponseWrapper getTreeProvinceCityCountyData(){
        return chinaProvinceCityService.getTreeProvinceCityCountyData();
    }

}
